package com.tmxk.jdbc03;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 测试饿汉式单例
 */
public class SingletonHungryTest {
    // 线程核心数量
    static final int corePoolSize = 30;
    static final ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(corePoolSize,corePoolSize,0,
            TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>());

    public static void main(String[] args) {
        for (int i = 0; i < 30 ; i++) {
            poolExecutor.submit(()->{
                System.out.println(SingletonHungry.getInstance());
            });
        }
    }
}
